package com.web.config;

import com.web.file.config.FileProperties;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SuppressWarnings("deprecation")
@Configuration
@RequiredArgsConstructor
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {

		private final FileProperties properties;
	
		@Override
		public void addResourceHandlers(ResourceHandlerRegistry registry) {
			// 配置静态文件访问路径
			registry.addResourceHandler("/static/file/**").addResourceLocations("file:"+properties.getPath());
		}
}
